home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / hash / Makefile < prev    next >
Encoding:
Makefile  |  1994-03-25  |  7.6 KB  |  273 lines  |  [TEXT/R*ch]

  1. #/bin/make
  2. # %W% %G% %U%
  3. #
  4. # hash - combined shs and md5 makefile
  5. #
  6. # This makefile was written by:
  7. #
  8. #     Landon Curt Noll  (chongo@toad.com)    chongo <was here> /\../\
  9. #
  10. # This makefile has been placed in the public domain.  Please do not 
  11. # copyright this makefile.
  12. #
  13. # LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH  REGARD  TO
  14. # THIS  SOFTWARE,  INCLUDING  ALL IMPLIED WARRANTIES OF MER-
  15. # CHANTABILITY AND FITNESS.  IN NO EVENT SHALL  LANDON  CURT
  16. # NOLL  BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  17. # DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM  LOSS  OF
  18. # USE,  DATA  OR  PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  19. # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR  IN
  20. # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21. #
  22. # See shsdrvr.c and md5drvr.c for version and modification history.
  23.  
  24. # standard tools
  25. #
  26. SHELL= /bin/sh
  27. TR= tr
  28. DIFF= diff
  29. INSTALL= install
  30.  
  31. # where to install binary files
  32. #
  33. BINDIR= /usr/local/bin
  34. #BINDIR= /usr/bin
  35. #BINDIR= /usr/contrib/bin
  36.  
  37. # where to install the shs and md5 test file dirs
  38. #
  39. # ${TOPDIR} is the directory under which the shs and md5 dirs will be placed.
  40. # ${SHSLIB} is where the readonly shs test files are kept
  41. # ${MD5LIB} is where the readonly md5 test files are kept
  42. #
  43. TOPDIR= /usr/local/lib
  44. #TOPDIR= /usr/lib
  45. #TOPDIR= /usr/libdata
  46.  
  47. SHSLIB= ${TOPDIR}/shs
  48. MD5LIB= ${TOPDIR}/md5
  49.  
  50. # where man pages are installed
  51. #
  52. # Use MANDIR= to disable installation of the calc man (source) page.
  53. #
  54. #MANDIR=
  55. MANDIR=/usr/local/man/man1
  56. #MANDIR=/usr/man/man1
  57. #MANDIR=/usr/share/man/man1
  58. #MANDIR=/usr/man/u_man/man1
  59. #MANDIR=/usr/contrib/man/man1
  60.  
  61. # where cat (formatted man) pages are installed
  62. #
  63. # Use CATDIR= to disable installation of the calc cat (formatted) page.
  64. #
  65. #CATDIR=
  66. CATDIR=/usr/local/man/cat1
  67. #CATDIR=/usr/man/cat1
  68. #CATDIR=/usr/share/man/cat1
  69. #CATDIR=/usr/man/u_man/cat1
  70. #CATDIR=/usr/contrib/man/cat1
  71.  
  72. # extenstion to add on to the calc man page filename
  73. #
  74. # This is ignored if CATDIR is empty.
  75. #
  76. MANEXT= 1
  77. #MANEXT= l
  78.  
  79. # extenstion to add on to the calc man page filename
  80. #
  81. # This is ignored if CATDIR is empty.
  82. #
  83. CATEXT= 1
  84. #CATEXT= 0
  85. #CATEXT= l
  86.  
  87. # how to format a man page
  88. #
  89. # We will execute ${NROFF} ${NROFF_ARG} calc.1 to format the calc man page.
  90. #
  91. # This is ignored if CATDIR is empty.
  92. NROFF= nroff
  93. #NROFF= groff
  94. NROFF_ARG = -man
  95. #NROFF_ARG = -mandoc
  96.  
  97. # select the proper compiler
  98. #
  99. # If you use a non-ANSI cc, you may have to edit md5.c to change the
  100. # UL constant suffixes in MD5Transform() to just L and see if test works.
  101. #
  102. #CC= cc
  103. CC= gcc -ansi
  104. #CC= gcc -ansi -fcaller-saves
  105.  
  106. # select the proper optimization or debug level
  107. #
  108. #OPT_DEBUG= -O
  109. OPT_DEBUG= -O2
  110. #OPT_DEBUG= -O3
  111. #OPT_DEBUG= -g
  112. #OPT_DEBUG= -O -DDEBUG
  113. #OPT_DEBUG= -O2 -DDEBUG
  114. #OPT_DEBUG= -O3 -DDEBUG
  115. #OPT_DEBUG= -g -DDEBUG
  116.  
  117. CFLAGS= ${OPT_DEBUG}
  118.  
  119. # Some architectures such as Sparc do not allow one to access long that
  120. # are not alligned.  If make test dumpds core or fails to produce no
  121. # output, use only -DMUST_ALIGN.
  122. #
  123. # ALIGN=        let must_align.c figure out if alignment is needed
  124. # ALIGN=-DMUST_ALIGN     force alignment (at the cost of performance}
  125. # ALIGN=-UMUST_ALIGN    allow non-aligment (usually at a performance gain}
  126. #
  127. ALIGN=
  128. #ALIGN=-DMUST_ALIGN
  129. #ALIGN=-UMUST_ALIGN
  130.  
  131. all: shs md5
  132.  
  133. shs: shsdrvr.o shsdual.o shs.o
  134.     ${CC} ${CFLAGS} -o shs shsdrvr.o shsdual.o shs.o
  135.  
  136. md5: md5drvr.o md5dual.o md5.o
  137.     ${CC} ${CFLAGS} -o md5 md5drvr.o md5dual.o md5.o
  138.  
  139. # perform all tests
  140. test: shs md5 shstest md5test
  141.  
  142. # perform the extended shs digest test
  143. shstest: shs file1 file2 file3 shs.data shs.ddata Makefile
  144.     @echo This shs test should produce no output
  145.     @./shs -x | ${DIFF} - shs.data
  146.     @./shs shs.data | \
  147.         sed '/^2dd09d381d4c3b73b4857ca4cce5c6f1b492c2f6 shs.data$$/d'
  148.     @./shs -q -c file3 | \
  149.         sed '/^0xa9f2c8b901a7c8628133694a105fc760bdccad2c$$/d'
  150.     @./shs -p abc -c file2 | \
  151.         sed '/^0xa9f2c8b901a7c8628133694a105fc760bdccad2c file2$$/d'
  152.     @./shs -P file1 file2 | \
  153.         sed '/^a9f2c8b901a7c8628133694a105fc760bdccad2c file2$$/d'
  154.     @./shs shs.ddata | \
  155.         sed '/^5b318beda8689cfcb2a5dcea0bac1d1d24ef2302 shs.ddata$$/d'
  156.     @./shs -d -x -q | ${DIFF} - shs.ddata
  157.  
  158. # perform the extended md5 digest test
  159. md5test: md5 file1 file2 file3 md5.data md5.ddata Makefile
  160.     @echo This md5 test should produce no output
  161.     @./md5 -x | ${DIFF} - md5.data
  162.     @./md5 md5.data | \
  163.         sed '/^9638425fd6b565e9fddf642fa4889125 md5.data$$/d'
  164.     @./md5 -q -c file3 | \
  165.         sed '/^0x68cfe1a8e5242c8e1e8152d0bc710631$$/d'
  166.     @./md5 -p abc -c file2 | \
  167.         sed '/^0x68cfe1a8e5242c8e1e8152d0bc710631 file2$$/d'
  168.     @./md5 -P file1 file2 | \
  169.         sed '/^68cfe1a8e5242c8e1e8152d0bc710631 file2$$/d'
  170.     @./md5 md5.ddata | \
  171.         sed '/^e1ac664dddab5c1b0d987a3d6ab0be9b md5.ddata$$/d'
  172.     @./md5 -d -x -q | ${DIFF} - md5.ddata
  173.  
  174. file1: Makefile
  175.     rm -f file1
  176.     echo abc | ${TR} -d '\012' > file1
  177.  
  178. file3: file1 file2
  179.     rm -f file3
  180.     cat file1 file2 > file3
  181.  
  182. shsdrvr.o: shsdrvr.c shs.h Makefile
  183.     ${CC} ${CFLAGS} -DTLIB=\"${SHSLIB}\" -c shsdrvr.c
  184.  
  185. shsdual.o: shsdual.c shs.h Makefile
  186.     ${CC} ${CFLAGS} -DTLIB=\"${SHSLIB}\" -c shsdual.c
  187.  
  188. shs.o: shs.c shs.h align.h endian.h Makefile
  189.     ${CC} ${CFLAGS} -c shs.c
  190.  
  191. md5drvr.o: md5drvr.c md5.h Makefile
  192.     ${CC} ${CFLAGS} -DTLIB=\"${MD5LIB}\" -c md5drvr.c
  193.  
  194. md5dual.o: md5dual.c md5.h Makefile
  195.     ${CC} ${CFLAGS} -DTLIB=\"${MD5LIB}\" -c md5dual.c
  196.  
  197. md5.o: md5.c md5.h align.h endian.h Makefile
  198.     ${CC} ${CFLAGS} -c md5.c
  199.  
  200. align.h: must_align
  201.     rm -f align.h
  202.     -./must_align > align.h 2>/dev/null
  203.  
  204. must_align: must_align.c
  205.     ${CC} ${CFLAGS} ${ALIGN} must_align.c -o must_align
  206.  
  207. endian.h: endian
  208.     rm -f endian.h
  209.     ./endian > endian.h
  210.  
  211. endian: endian.c
  212.     ${CC} ${CFLAGS} endian.c -o endian
  213.  
  214. install: all file1 file2 shs.data md5.data shs.1 md5.1
  215.     -rm -f ${BINDIR}/shs
  216.     ${INSTALL} -c -m 0555 shs ${BINDIR}
  217.     -rm -f ${BINDIR}/md5
  218.     ${INSTALL} -c -m 0555 md5 ${BINDIR}
  219.     -@if [ ! -d "${TOPDIR}" ]; then \
  220.         echo "mkdir ${TOPDIR}"; \
  221.         mkdir "${TOPDIR}"; \
  222.     fi
  223.     -@if [ ! -d "${SHSLIB}" ]; then \
  224.         echo "mkdir ${SHSLIB}"; \
  225.         mkdir "${SHSLIB}"; \
  226.     fi
  227.     ${INSTALL} -c -m 0444 file1 ${SHSLIB}
  228.     ${INSTALL} -c -m 0444 file2 ${SHSLIB}
  229.     ${INSTALL} -c -m 0444 shs.data ${SHSLIB}
  230.     -@if [ ! -d "${MD5LIB}" ]; then \
  231.         echo "mkdir ${MD5LIB}"; \
  232.         mkdir "${MD5LIB}"; \
  233.     fi
  234.     ${INSTALL} -c -m 0444 file1 ${MD5LIB}
  235.     ${INSTALL} -c -m 0444 file2 ${MD5LIB}
  236.     ${INSTALL} -c -m 0444 md5.data ${MD5LIB}
  237.     -@if [ -z "${MANDIR}" ]; then \
  238.         echo "man pages are not installed, $${MANDIR} is empty"; \
  239.     else \
  240.         echo "rm -f ${MANDIR}/shs.${MANEXT} ${MANDIR}/md5.${MANEXT}"; \
  241.         rm -f ${MANDIR}/shs.${MANEXT} ${MANDIR}/md5.${MANEXT}; \
  242.         echo "cp shs.1 ${MANDIR}/shs.${MANEXT}"; \
  243.         cp shs.1 ${MANDIR}/shs.${MANEXT}; \
  244.         echo "cp md5.1 ${MANDIR}/md5.${MANEXT}"; \
  245.         cp md5.1 ${MANDIR}/md5.${MANEXT}; \
  246.         echo "chmod 0444 ${MANDIR}/shs.${MANEXT} ${MANDIR}/md5.${MANEXT}"; \
  247.         chmod 0444 ${MANDIR}/shs.${MANEXT} ${MANDIR}/md5.${MANEXT}; \
  248.     fi
  249.     -@if [ -z "${CATDIR}" ]; then \
  250.         echo "cat pages are not installed, $${CATDIR} is empty"; \
  251.     else \
  252.         echo "rm -f ${CATDIR}/shs.${CATEXT} ${CATDIR}/md5.${CATEXT}"; \
  253.         rm -f ${CATDIR}/shs.${CATEXT} ${CATDIR}/md5.${CATEXT}; \
  254.         echo "${NROFF} ${NROFF_ARG} shs.1 > ${CATDIR}/shs.${CATEXT}"; \
  255.         ${NROFF} ${NROFF_ARG} shs.1 > ${CATDIR}/shs.${CATEXT}; \
  256.         echo "${NROFF} ${NROFF_ARG} md5.1 > ${CATDIR}/md5.${CATEXT}"; \
  257.         ${NROFF} ${NROFF_ARG} md5.1 > ${CATDIR}/md5.${CATEXT}; \
  258.         echo "chmod 0444 ${CATDIR}/shs.${CATEXT} ${CATDIR}/md5.${CATEXT}"; \
  259.         chmod 0444 ${CATDIR}/shs.${CATEXT} ${CATDIR}/md5.${CATEXT}; \
  260.     fi
  261.  
  262. clean:
  263.     rm -f shs.o shsdrvr.o shsdual.o
  264.     rm -f md5.o md5drvr.o md5dual.o 
  265.     rm -f syscrypt.o
  266.     rm -f file1 file3 
  267.     rm -f endian.h endian.o endian
  268.     rm -f align.h must_align must_align.o
  269.     rm -f core core.must_align core.shs core.md5
  270.  
  271. clobber: clean
  272.     rm -f shs md5
  273.